//
//  CatchFlipInfoController.m
//  HelloWordPrimer
//
//  Created by erik on 2009-10-25.
//  Copyright 2009 __MyCompanyName__. All rights reserved.
//

#import "CatchFlipInfoController.h"
#import "Catch.h"

@implementation CatchFlipInfoController
@synthesize delegate;
@synthesize imageView;
@synthesize theCatch;
@synthesize catchPhoto;
@synthesize dateLabel;
@synthesize speciesLabel;
@synthesize weightLabel;

- (IBAction)done {
	[self.delegate flipsideViewControllerDidFinish:self];	
}


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
	
	if(theCatch){
		
		[self.dateLabel setText:[[NSString alloc]initWithFormat:@"Date: %@",theCatch.catchDate]];
		[self.speciesLabel setText:[[NSString alloc]initWithFormat:@"Species: %@",theCatch.species]];
		[self.weightLabel setText:[[NSString alloc]initWithFormat:@"Weight: %@",theCatch.weight]];
		
		if(catchPhoto){
			UIImage *image = [[UIImage alloc]initWithData:[catchPhoto data]];
			[imageView setImage:image];
		}
	} 
}


- (void)didReceiveMemoryWarning {
	// Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
	
	// Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
	imageView = nil;
	theCatch = nil;
	catchPhoto = nil;
}


- (void)dealloc {
    [super dealloc];
	[imageView release];
	[theCatch release];
	[catchPhoto release];
}


@end
